/**
 * File: request.tsx
 * Project: reactssr
 * Created Date: Wednesday 2018/01/03 14:18:02
 * Author: zhengjiang
 * -----
 * Last Modified: Thursday 2018/01/04 13:46:51
 * Modified By: zhengjiang
 * -----
 * Description: 
 * 
 */

/**
 * fetch 检查
 */
export const fetchCheck = (response) => {
	try {
		return response.json();
	} catch (e) {
		return response;
	}
};

//fetch 请求 根据接口返回做相应的处理

/**
  * fetch catch 处理
  */
export const fetchCatch = (res) => {
	try {
		return res.json();
	} catch (e) {
		return { success: false, error: { message: '未知错误' } };
	}
};

/**
 * fetch error 处理
 */
export const ParseErrorMsg = (error) => {
	try {
		return error.message;
	} catch (e) {
		return '未知错误';
	}
};
